package src.main.java.org.oop.extend.constructor1;

public class Test {
    public static void main(String[] args) {
        Student student = new Student("李四", 26, "清华大学");

        //如果学生没有填写学校，学生默认是北大
    }
}
class Student{
    private String name;
    private int age;
    private String schoolName;

    public Student() {
    }

    public Student(String name, int age) {
        this(name,age,"北京大学"); //调用该类的其他构造器
    }

    public Student(String name, int age, String schoolName) {
        this.name = name;
        this.age = age;
        this.schoolName = schoolName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }
}
